package com.gyhj.questionaires.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyhj.questionaires.handler.BusinessException;
import com.gyhj.questionaires.mapper.QuestionAiresEntityMapper;
import com.gyhj.questionaires.model.entity.QuestionAiresEntity;
import com.gyhj.questionaires.service.QuestionAiresEntityService;
import java.time.LocalDateTime;
import org.springframework.stereotype.Service;

/**
 * <h1>
 *
 * </h1>
 *
 * @author MarkerCCC
 * @date 2020/4/14 - 15:19
 * @since 2020/4/14 - 15:19 星期二 by MarkerCCC markerccc@163.com
 */
@Service
public class QuestionAiresEntityServiceImpl extends ServiceImpl<QuestionAiresEntityMapper, QuestionAiresEntity> implements
        QuestionAiresEntityService {

    @Override
    public Boolean saveQuestionAiresEntity(QuestionAiresEntity questionAiresEntity) {
        LocalDateTime now = LocalDateTime.now();
        questionAiresEntity.setCreatedTime(now)
                .setModifiedTime(now);
        int insert = baseMapper.insert(questionAiresEntity);
        if (insert != 1) {
            throw new BusinessException("保存信息失败");
        }
        return Boolean.TRUE;
    }
}
